<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers:X-Token,Content-Type,Authorization,safeString');
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS');


// 添加用户记录
Route::post('/records', 'RecordsController@store');


// 登录
Route::post('login', 'UserController@login');

Route::group(['middleware' => 'auth:api'], function (){

    // 记录列表
    Route::get('/records', 'RecordsController@index');

    // 退出
    Route::post('logout', 'UserController@logout');
});

